/*
 * @Description:
 * @Author: zhaolei
 * @Date: 2023-04-13 14:51:20
 */
export const tableOption = (typeList = []) => {
  return {
    ...window.$crudMixins.tableOptions,
    addBtn: false,
    editBtn: false,
    delBtn: false,
    searchLabelWidth: 130,
    labelWidth: 130,
    viewBtn: false,
    menuWidth: 280,
    column: [
      {
        label: '内容编号',
        prop: 'id',
      },
      {
        label: '发布用户编号',
        prop: 'userCode',
        search: true,
      },
      {
        label: '发布用户昵称',
        prop: 'userNickname',
        search: true,
      },
      {
        label: '发布时间',
        prop: 'searchCreateTime',
        type: 'date',
        width: 160,
        format: 'yyyy-MM-dd',
        valueFormat: 'yyyy-MM-dd',
        searchRange: true,
        search: true,
        hide: true,
      },
      {
        label: '发布时间',
        prop: 'createTime',
        type: 'datetime',
        width: 160,
        format: 'yyyy-MM-dd HH:mm:ss',
        valueFormat: 'yyyy-MM-dd HH:mm:ss',
      },
      {
        label: '内容类型',
        prop: 'type',
        search: true,
        type: 'select',
        dicData: typeList,
      },
      {
        label: '关联宠物ID',
        prop: 'petList',
        width: 160,
        overHidden: true,
        formatter: (row) => {
          return row.petList.map((el) => el.id).join('，');
        },
      },
      {
        // 状态（1：正常，2：已屏蔽）
        label: '展示状态',
        prop: 'status',
        type: 'select',
        search: true,
        dicData: [
          {
            label: '正常',
            value: '1',
          },
          {
            label: '已屏蔽',
            value: '2',
          },
        ],
      },
      {
        label: '可见状态',
        prop: 'publicFlag',
        type: 'select',
        dicData: [
          {
            label: '私人可见',
            value: '0',
          },
          {
            label: '公开可见',
            value: '1',
          },
        ],
      },
    ],
  };
};
